const ApiDef = require('./impl')
const kong_cfg = configure.get('kong')

class targetService {
    constructor () {
        this.apiBaseUrl = kong_cfg.kong_admin
    }

    add (name,data) {
        return ApiDef.post(`${this.apiBaseUrl}upstreams/${name}/targets`, data)
    }

    list (name) {
        return ApiDef.get(`${this.apiBaseUrl}upstreams/${name}/targets`)
    }

    delete (name,target) {
        return ApiDef.delete(`${this.apiBaseUrl}upstreams/${name}/targets/${target}`)
    }
}

module.exports = new targetService()

